import Vue from 'vue'
import VueRouter from 'vue-router'
import hasNav from '@/views/hasNav'
import coin from '@/views/coin'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'coin',
    component: coin
  },
  {
    path: '/hasNav/:room',
    name: "hasNav",
    component:hasNav
  }
]

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  if(typeof(location)=="string"){
    var Separator = "&";
    if(location.indexOf('?')==-1) { Separator='?'; }
    location = location + Separator + "random=" + Math.random();
  }
  return routerPush.call(this, location).catch(error=> error)
}
const router = new VueRouter({
  routes
})

export default router
